package com.example.tijianbackend.utils;

import java.lang.reflect.Field;

/**
 * @author: bong~
 * @description: TODO
 * @date: 2024/6/14 10:59
 * @version: 1.0
 */

public class ObjectUtils {

    public static boolean AllFieldNotNullOrEmpty(Object obj){

        if(obj==null){
            return false;
        }

        Field[] fields=obj.getClass().getDeclaredFields();

        for(Field field:fields){
            try{
                field.setAccessible(true) ;
                Object value=field.get(obj);

                if(value==null || (value instanceof String && ((String)value).isEmpty())){
                    return false;
                }
            }catch (IllegalAccessException e){
                e.printStackTrace();
            }
        }
        return true;

    }
}
